﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


/// <summary>
/// 泛型单例不继承MonoBehaviour
/// </summary>
/// <typeparam name="T"></typeparam>
public class Singleton<T> where T : new()
{
    public static T Instance
    {
        get
        {
            return Nested.instance;
        }
    }

    class Nested
    {
        static Nested() { }

        internal static readonly T instance = new T();
    }
}
